<template>
  <div>
    <el-tree
      :data="menu"
      show-checkbox
      node-key="name"
      :props="defaultProps"
      ref="tree"
    >
    </el-tree>
    <el-button @click="getData">获取信息</el-button>
  </div>
</template>
<script>
export default {
    data () {
        return {
            menu:[],
            defaultProps:{
                label:'name',
                children:'children'
            }
        }
    },
    created () {
        this.menu=[...this.$router.options.routes]
    },
    methods: {
        getData(){
            console.log(this.$refs.tree.getCheckedNodes())
            // 向后端发送信息，设置权限
        }
    }
}
</script>
<style scoped>

</style>